<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>我的订单 - ${web.name}${web.additionalTitle!}</title>
<link href="${root}/u/css/main.css" type="text/css" rel="stylesheet" />
<link href="${root}/u/css/memeber.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="${sysResRoot}/jquery.js" ></script>
<script src="${base}/thirdparty/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
<script type="text/javascript">
function g(o){
	return document.getElementById(o);
}
function HoverLi(m,n,counter){
		for(var i=1;i<=counter;i++){
			g('tb_'+m+i).className='dd_normal';
			g('tbc_'+m+i).className='undis';
		}
		g('tbc_'+m+n).className='dis';
		g('tb_'+m+n).className='';
}
function eidtOrder(orderId,status){
	$.post("../order/editOrder.jspx", {
		'orderId' : orderId,
		'status' : status
	}, function(data) {
		if(data.success){
			location.reload();
		}
	},'json');
}

//再次放进购物车
function addCart(orderId){
	$("#orderId").val(orderId);
    $("#jvForm").attr("action","${base}/cart/add_orderItem1.jspx");
	$("#jvForm").submit();
}
//立即支付
function payOrderAgain(orderId,code){
	$("#orderId").val(orderId);
	$("#code").val(code);
    $("#jvForm").attr("action","${base}/pay.jspx");
	$("#jvForm").submit();
}

//删除订单
function deleteOrder(orderId){
	$("#jvForm").submit(function(){
		return false;
	});
	$.post("${base}/order/deleteOrder.jspx", {
		'orderId' : orderId
	}, function(data) {
		if(data.success){
			location.href=location.href;
		}
	},'json');
}

//取消订单
function abolishOrder(orderId){
	//阻止form表单提交
	$("#jvForm").submit(function(){
		return false;
	});
	$.post('abolishOrder.jspx', {
		'orderId' : orderId
	}, function(data) {
		if(data.success){
			location.reload();
		}
	},'json');
}

//确认收货
function accomplishOrder(orderId){
	$("#jvForm").submit(function(){
		return false;
	});
	$.post('${base}/order/accomplishOrder.jspx', {
		'orderId' : orderId
	}, function(data) {
		if(data.success){
			location.reload();
		}
	},'json');
}

function showHide(pd){
	if(pd==0){
	  $("#J_MoreControl").hide();
	  $("#moreFilter").show();
	  $("#lessFilter").hide();
	}else{
		$("#J_MoreControl").show();
		$("#moreFilter").hide();
		$("#lessFilter").show();
	}
}
</script>
<style>
.dingdanbutton{ background:#ffffff; cursor:pointer; color:#4b4b4b;}
</style>
</head>
<body>
[#include "../include/会员中心页头顶栏.html"/]
<div class="w1168">
	[#include "会员中心_导航.html"/]
	<div id="container" class="user_right">
		<div class="user_title_r">
			<div class="user_title_l">我的订单</div>
        </div>
        <div class="clear20"></div>
        <form id="jvForm" action="myorder.jspx" method="post">
            <input type="hidden" id="orderId" name="orderId" />
            <input type="hidden" id="code" name="code"/>
            <input id="productName" type="text" maxlength="30" value="" class="bought-search fl" name="productName" size="50"/><button class="menu_searchdingdan fl" type="submit">订单搜索</button>
            <div style=" line-height:29px; background:url(/r/gou/u/img/member/icon_xialacaidan.gif) no-repeat 78px 12px; float:left; width:200px;">
                [#if startTime??||endTime??||userName??||paymentId??||startOrderTotal??||endOrderTotal??||shippingId??]
                <a class="less-filter" id="lessFilter" href="javascript:void(0);" onclick="showHide(0);">精简筛选条件</a>
                <a class="more-filter" id="moreFilter" href="javascript:void(0);" onclick="showHide(1);" style="display:none; ">更多筛选条件</a>
                [#else]
                <a class="more-filter" id="moreFilter" href="javascript:void(0);" onclick="showHide(1);">更多筛选条件</a>
                <a class="less-filter" id="lessFilter" href="javascript:void(0);" onclick="showHide(0);" style="display:none;">精简筛选条件</a>
                [/#if]
            </div>
            <div class="clear10"></div>
            
            <ul id="J_MoreControl" [#if !(startTime??||endTime??||userName??||paymentId??||startOrderTotal??||endOrderTotal??||shippingId??)]style="display:none;"[/#if]>
                <li style="height:30px;">下单时间：
                <input type="text" name="startTime" value="${startTime!}" class="Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" style="width:90px; height:22px;" size="10"/>&nbsp;到
                <input type="text" name="endTime"  value="${endTime!}" class="Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" style="width:90px; height:22px;" size="10"/>
                </li>
                <li style="height:30px;">
                收&nbsp;货&nbsp;人：
                <input id="userName" type="text"name="userName" class="input_w150" value="${userName!}" size="15"/>
                </li>
                <li style="height:30px;">
                支付方式：
                <select id="paymentId" name="paymentId" class="input_w120">
                <option value="">--支付方式--</option>
                [#list paymentList as payment]
                <option value="${payment.id}"[#if paymentId??] [#if paymentId==payment.id]selected="selected"[/#if][/#if]>${payment.name!}</option>
                [/#list]
                </select>
                </li>
                <li style="height:30px;">
                订单金额：
                <input type="text" name="startOrderTotal" value="${startOrderTotal!}" class="input_w150" />至
                <input type="text" name="endOrderTotal" value="${endOrderTotal!}" class="input_w150" />
                </li>
                <li style="height:30px;">
                配送方式：
                <select id="shippingId" name="shippingId" class="input_w120">
                <option value="">--配送方式--</option>
                [#list shippingList as shipping]
                <option value="${shipping.id}"[#if shippingId??] [#if shippingId==shipping.id]selected="selected"[/#if][/#if]>${shipping.name!}</option>
                [/#list]
                </select>
                </li>
            </ul>
        	<div class="clear10"></div>
            <div class="odrTab">
                <ul class="ul_select odrTabUl" style="border-bottom:1px solid #ebebeb;">
                    <li [#if !(ass??)]class="first cur"[/#if] onclick="location='${base}/order/myorder.jspx?cl=tbg_11&memberId=${member.id!}'"> 全部[@order_page memberId=member.id count='3'](${tag_pagination.totalCount})[/@order_page]</li>
                    <li [#if paymentStatus??&paymentStatus==1] class="first cur" [/#if] onclick="location='${base}/order/myorder.jspx?cl=tbg_11&paymentStatus=1&memberId=${member.id!}&ass=1'">待支付[@order_page paymentStatus='1' memberId=member.id  count='3'](${tag_pagination.totalCount})[/@order_page]</li>
                    <li [#if paymentStatus??&paymentStatus==2] class="first cur" [/#if] onclick="location='${base}/order/myorder.jspx?cl=tbg_11&paymentStatus=2&memberId=${member.id!}&ass=1'">已付款[@order_page paymentStatus='2' memberId=member.id  count='3'](${tag_pagination.totalCount})[/@order_page]</li>
                    <li [#if shippingStatus??&shippingStatus==2&&status==2] class="first cur" [/#if] onclick="location='${base}/order/myorder.jspx?cl=tbg_11&shippingStatus=2&memberId=${member.id!}&status=2&ass=1'"> 待收货[@order_page shippingStatus='2' status='2' memberId=member.id  count='3'](${tag_pagination.totalCount})[/@order_page]</li>
                    <li [#if status??&status==4] class="first cur" [/#if] onclick="location='${base}/order/myorder.jspx?cl=tbg_11&status=4&memberId=${member.id!}&ass=1'">完成的订单[@order_page status='4' memberId=member.id  count='3'](${tag_pagination.totalCount})[/@order_page]</li>
                    <li [#if status??&status==3] class="first cur" [/#if] onclick="location='${base}/order/myorder.jspx?cl=tbg_11&status=3&memberId=${member.id!}&ass=1'">已取消的订单[@order_page status='3' memberId=member.id  count='3'](${tag_pagination.totalCount})[/@order_page]</li>
                </ul>
            </div>
            <div class="clear"></div>
            <div style="border:1px solid #ebebeb; border-top:0;">
            <table width="100%" border="0" cellspacing="0" cellpadding="0" style=" font-size:12px; font-family:Arial; color:#4b4b4b;">
            <tr>
            <td width="40" align="center" bgcolor="#fafafa">&nbsp;</td>
            <td width="100" height="32" bgcolor="#fafafa">全选&nbsp;&nbsp;&nbsp;删除</td>
            <td bgcolor="#fafafa">商品名称</td>
            <td width="100" align="center" bgcolor="#fafafa">单价（元）</td>
            <td width="70" align="center" bgcolor="#fafafa">数量</td>
            <td width="100" align="center" bgcolor="#fafafa">实付款（元）</td>
            <td width="100" align="center" bgcolor="#fafafa">支付方式</td>
            <td width="100" align="center" bgcolor="#fafafa">交易状态</td>
            <td width="110" align="center" bgcolor="#fafafa">交易操作</td>
            </tr>
            [@order_page status=status count='3' memberId=member.id productName=productName userName=userName paymentId=paymentId shippingId=shippingId startTime=startTime endTime=endTime startOrderTotal=startOrderTotal endOrderTotal=endOrderTotal paymentStatus=paymentStatus shippingStatus=shippingStatus]
            [#if tag_list?size gt 0]
				[#list tag_list as order]
					<tr>
						<td height="34" colspan="9" class="djBg" style="padding:0 5px;">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
							<tr>
							<td>
							<span>订单编号：</span><a href="myOrderView.jspx?orderId=${order.id}" target="_blank">${order.code!}</a>
							</td>
							<td>
							[#if order.store??]							
								<a href="http://${order.store.domain!}" target="_blank">${order.store.storeExt.shortName!}</a>		
							[#else]
							店中店自营
							[/#if]
							</td>
							<td><span>订单时间：</span><a>${order.createTime?string('yyyy-MM-dd HH:mm:ss')!}</a></td>
							<td width="110" align="center"><a href="myOrderView.jspx?orderId=${order.id}" target="_blank">订单详情</a></td>
							</tr>
							</table>
						</td>
					</tr>
					[#list order.items as item]
						<tr>			
							<td height="95" align="center">&nbsp;</td>
							<td align="center">
							<a target="_blank" href="${item.product.url}" class="fl">
							<img src="${root!}${item.product.productExt.coverImg!}" height="80" width="80" style=" border:1px solid #e9e9e9;" />
							</a>
							</td>
							<td>
							<a target="_blank" href="${item.product.url}">${item.product.name}</a>
							</td>
							<td width="75" align="center">
							
							¥[#if item.productFash??]
								${item.productFash.salePrice!}
							[#else]
								${item.product.salePrice!}
							[/#if]
							</td>
							<td align="center">
							<!-- 数量 -->${item.count}<!-- 数量 -->
							</td>
							<td align="center">
							<!-- 实付款 -->¥${order.total}<!-- 实付款 -->
							</td>
							<td align="center">
							<!-- 支付方式 -->${order.payment.name}<!-- 支付方式 -->
							</td>
							<td align="center">
							<!-- 订单状态 -->
							[#if order.status=3]
								[@s.m "order.status.${order.status}"/]
							[#elseif order.status=4]
								[@s.m "order.status.${order.status}"/]
							[#elseif order.paymentStatus=1]
								[@s.m "order.paymentStatus.${order.paymentStatus}"/]<br />
								[#if order.shippingStatus=2]
									[@s.m "order.shippingStatus.${order.shippingStatus}"/]
								[/#if]
							[#elseif order.paymentStatus=2]
								[@s.m "order.paymentStatus.${order.paymentStatus}"/]<br />
								[@s.m "order.shippingStatus.${order.shippingStatus}"/]
							[/#if]
							<!-- 订单状态 -->
							<br />
							<!-- 查看物流 -->
							[#if order.shippingStatus==2]<a class="aBlu" href="viewLogistic.jspx?orderId=${order.id}" target="_blank">查看物流</a>[/#if]
							<!-- 查看物流 -->
							</td>
							<td align="center">
							<button class="dingdanbutton" onclick="addCart(${order.id});">再放进购物车</button><br />
							[#if order.status==3]
								<button class="dingdanbutton" onclick="deleteOrder(${order.id});" >删除订单</button>
							[#elseif order.status==4]
								<button class="dingdanbutton" onclick="deleteOrder(${order.id});" >删除订单</button>
								[#if !(order.returnOrder??)] 
									<a href="../orderReturn/orderReturn.jspx?orderId=${order.id}&delivery=1">申请退货</a>
								[/#if]
							[#elseif order.shippingStatus==1]
								[#if order.paymentStatus==1]
									<button class="dingdanbutton" onclick="payOrderAgain('${order.id}','${order.payment.code}');">立即支付</button><br />
									<button class="dingdanbutton" onclick="abolishOrder(${order.id});" >取消订单</button>
								[#elseif order.paymentStatus==2]
									[#if !(order.returnOrder??)] 
										<a href="../orderReturn/orderReturn.jspx?orderId=${order.id}&delivery=0" target="_blank">申请退款</a>
									[/#if]
								[/#if]
							[#elseif order.shippingStatus==2]
								[#if order.paymentStatus==2]
									<button class="dingdanbutton" onclick="accomplishOrder(${order.id});">确认收货</button>
								[/#if]
								[#if order.after]已经申请了售后
								[#else]
									[#if order.status==19]<a href="${base}/aftersale/add.jspx?orderId=${order.id}" target="_blank">申请售后</a>[/#if]
								[/#if]
								[#if order.status==19]<a href="${base}/reportFro/report_apply.jspx?orderId=${order.id}" target="_blank">投诉卖家</a>[/#if]
								[#if order.status==19]<a href="${base}/orderReturn/orderReturn.jspx?orderId=${order.id}&delivery=1" target="_blank">申请退货</a>[/#if]
								[#if order.status==11]<a href="${base}/refundFro/refund_apply.jspx?orderId=${order.id}" target="_blank">申请退款</a>[/#if]
							[/#if]
							</td>
						</tr> 
					[/#list]
				[/#list]
            [#else]
				<div class="zwsj">暂无相关订单 ，这就去<a href="${base}/" style=" color:#ff0000;">JSPGOU商城</a>挑选商品。</div>
            [/#if]
            </table>
            <div class="clear20"></div>
            <div class="pageNumber">[@pagination_style sysPage='3'/]</div>
            [/@order_page] 
            
            </div>
        </form>
	</div>
	<div class="clear20"></div>
</div>
[#include "../include/页脚信息栏.html"/]
</body>
</html>